
/* Create Line in XZ plane. */
osg::ref_ptr<osg::Geometry> create_line(float x1, float z1, float x2, float z2)
{
    osg::ref_ptr<osg::Geometry> geom = new osg::Geometry;
    osg::ref_ptr<osg::Vec3Array> v = new osg::Vec3Array;

    v->push_back( osg::Vec3(x1, 0, z1) );
    v->push_back( osg::Vec3(x2, 0, z2) );

    geom->setVertexArray( v.get() );
    geom->addPrimitiveSet(
        new osg::DrawArrays( osg::PrimitiveSet::LINES, 0, 2 ) );

    osg::StateSet* stateset = new osg::StateSet;
    osg::LineWidth* linewidth = new osg::LineWidth();

    linewidth->setWidth(4.0f);
    stateset->setAttributeAndModes(linewidth,osg::StateAttribute::ON);
    geom->setStateSet(stateset);

    return geom.get();

}

